# Contributor: Holger Jaekel <holger.jaekel@gmx.de>
# Maintainer: Holger Jaekel <holger.jaekel@gmx.de>
pkgname=libqb3
pkgver=1.2.0
pkgrel=0
pkgdesc="Fast and efficient raster compression"
url="https://github.com/lucianpls/QB3"
arch="all !armhf !armv7 !x86 !s390x"  # requires little endian, 64bit
license="Apache-2.0"
options="!check"  # no tests
makedepends="clang cmake samurai"
subpackages="$pkgname-dev"
source="libqb3-$pkgver.tar.gz::https://github.com/lucianpls/QB3/archive/refs/tags/V$pkgver.tar.gz
	10-soversion.patch
	20-cmake_destination.patch"
builddir="$srcdir/QB3-$pkgver"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		local crossopts="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	CC=clang \
	CXX=clang++ \
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=ON \
		-DCMAKE_BUILD_TYPE=None \
		-DBUILD_CQB3=OFF \
		$crossopts
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
420885a02ff68beaf342268d34a37e282f10b46600bc5e27db440de7f24bc3e3670dca312386d55f44642cefa2761a871fe62cafa90bab430c7d096a485efe3b  libqb3-1.2.0.tar.gz
e6322afb53ffefa4ea2e2bf5ba77d6d4685090a0b49ac3134bb9fda11b933645b13b75f64ba4ca76b4358a83a9cb639b2d0e8f98aab46f14d1bf3a0dde1a0fb8  10-soversion.patch
c263135219f8a156b011feacefe7fa29c4f4cbf7e1dc12faf2a2257fb177885ad92d786af8b8d0b0d423461d74a28f92063a4151ff219855207e67f32dfa6c5e  20-cmake_destination.patch
"
